#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
@file_name: incorrectly_using_blocking_api_in_coroutine.py
@date: 2025-07-28 14:57
@author: Falling Snow
@desc: 在协程中错误的使用阻塞式API
"""
import asyncio

import requests

from util import async_timed


@async_timed()
async def get_example_status() -> int:
    return requests.get("https://www.example.com/").status_code


@async_timed()
async def main():
    task_1 = asyncio.create_task(get_example_status())
    task_2 = asyncio.create_task(get_example_status())
    task_3 = asyncio.create_task(get_example_status())

    await task_1
    await task_2
    await task_3


if __name__ == '__main__':
    asyncio.run(main())
